package com.twu.biblioteca.presenter;

import com.twu.biblioteca.model.session.Session;
import com.twu.biblioteca.model.session.SessionManager;
import com.twu.biblioteca.view.LogoutView;

/**
 * Created with IntelliJ IDEA.
 * User: cschlumb
 * Date: 19/08/2013
 * Time: 10:08
 * To change this template use File | Settings | File Templates.
 */
public class LogoutPresenter implements Presenter{

    public interface Display{
        public void successMessage();
    }

    private final SessionManager sessionManager;
    private final Display view;

    public LogoutPresenter(SessionManager sessionManager, Display view) {
        this.sessionManager = sessionManager;
        this.view = view;
    }

    @Override
    public void go(Session session) {
        sessionManager.invalidate(session);
        view.successMessage();
    }
}
